package com.iiapk.gridnew.view;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface.OnClickListener;
import android.view.View;

import com.iiapk.gridnew.R;

public class SimpleAlertDialog {
	
	private AlertDialog.Builder bulider; 
	private static SimpleAlertDialog mInstance; 
	private static Context mContext;
	 
	public static SimpleAlertDialog getInstance(Context context) {
		mContext=context;
		if (mInstance == null) {
			mInstance = new SimpleAlertDialog();
		}
		return mInstance;
	}
	
	public void initSimple(int stringId){
		bulider = new AlertDialog.Builder(mContext);
		bulider.setTitle(R.string.dialog_metion);
		bulider.setMessage(stringId);
		bulider.setNegativeButton(R.string.dialog_close, null);
		bulider.create().show();
	}
	
	public void initSimple(String stringId){
		bulider = new AlertDialog.Builder(mContext);
		bulider.setTitle(R.string.dialog_metion);
		bulider.setMessage(stringId);
		bulider.setNegativeButton(R.string.dialog_close, null);
		bulider.create().show();
	}
	
	public void initSimple(int titleId,int contentId){
		bulider = new AlertDialog.Builder(mContext);
		bulider.setTitle(titleId);
		bulider.setMessage(contentId);
		bulider.setNegativeButton(R.string.dialog_close, null);
		bulider.create().show();
	}
	
	public void initSimple(int titleId,View view){
		bulider = new AlertDialog.Builder(mContext);
		bulider.setTitle(titleId);
		bulider.setView(view);
		//bulider.setNegativeButton(R.string.dialog_close, null);
		AlertDialog dialog = bulider.create();
		dialog.show();
	}
	
	public AlertDialog initSimpleAlertDialog(int titleId,View view){
		bulider = new AlertDialog.Builder(mContext);
		bulider.setTitle(titleId);
		bulider.setView(view);
		//bulider.setNegativeButton(R.string.dialog_close, null);
		AlertDialog dialog = bulider.create();
		dialog.show();
		return dialog;
	}
	
	public void initSimple(int titleId,View view,OnClickListener listener){
		bulider = new AlertDialog.Builder(mContext);
		bulider.setTitle(titleId);
		bulider.setView(view);
		bulider.setNegativeButton(R.string.dialog_close, listener);
		AlertDialog dialog = bulider.create();
		dialog.show();
	}
	
	public void initSimpleListener(int stringId,OnClickListener listener){
		bulider = new AlertDialog.Builder(mContext);
		bulider.setTitle(R.string.dialog_metion);
		bulider.setMessage(stringId);
		bulider.setNegativeButton(R.string.dialog_close, listener);
		bulider.create().show();
	}
	
	public void initSimpleListener(String stringId,OnClickListener listener){
		bulider = new AlertDialog.Builder(mContext);
		bulider.setTitle(R.string.dialog_metion);
		bulider.setMessage(stringId);
		bulider.setNegativeButton(R.string.dialog_close, listener);
		bulider.create().show();
	}
			
}
